Re: "The object to which this links refers has been purged" llandale - Tue Apr 20 15:08:09 EDT 2010
The Object object(int absno,Module m) command only finds displayed objects. I imagine that's the same for gotoObject() as well.
gotoObject suggests updating views and displaying the object, so I imagine it only really works for displayed modules.
These functions are inferior since they don't always work (they are dependant on the current display set). Write your own object searcher. You can put all the target objects in a Skip list (for oTarget in entire mTarget do) using int AbsNo as the key and Object as the Data, then search the Skip.
You seem to be getting this error when you attempt to create the link. Perhaps change that code to
noError
Link lnk = target -> source
string ErrMess = lastError()
if (null lnk or !null ErrMess)
{ deal with no link
}
Or perhaps link the Source TO the Target. Or perhaps use a specific link module.
I've had trouble with 'null' and frankly don't quite understand it completely. I suspect that you source is not 'null' enough for the 'if' statement, but is 'null' enough for the linking, where you are actually getting that error.
Or more likely (now that I think of it), perhaps the 'gotoObject' function is NOT finding the object and NOT updating the 'source' variable, which retains its non-null status from the previous loop using a different module now closed. 'source' is non-null but points to an object in a closed module ... confusing everybody and getting that 'purged' error.
Or maybe you lack read-rights to 'source', but gotoObject finds it anyway.
Avoid using known perms as identifiers, 'module' in this case. If nothing else its bad Karma for those who read it, and sometimes its bad Dogma for the code itself. Years ago I got myself in trouble calculating the length of a string using variable 'length'. Never figured it out, but the bug went away when I spelled it 'Length'.
|